//
//  BaseMacro.h
//  翼安保
//
//  Created by duzhi on 2024/4/15.
//

#ifndef BaseMacro_h
#define BaseMacro_h

//屏幕比例适配
#define phoneWidthAndHeightScale [UIScreen mainScreen].bounds.size.width/390.0f
#define relativeWidth(Value) floorf(phoneWidthAndHeightScale*Value)
//屏幕宽
#define ScreenWidth      [[UIScreen mainScreen] bounds].size.width
//屏幕高
#define ScreenHeight     [[UIScreen mainScreen] bounds].size.height
//rgb取色
#define kiPhone6SFixFont(Value) ((CGFloat)(Value*[UIScreen mainScreen].bounds.size.width/375.0f))
#define RGBAColor(r,g,b,a) [UIColor colorWithRed: r/255.0 green: g/255.0 blue: b/255.0 alpha: a]
#define RGBColor(r,g,b)    RGBAColor(r,g,b,1)
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
// 判断是否为iPhone X 全系列
#define kiPhoneXAll \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})

// iPhoneX全系导航栏增加高度 (64->88)
#define kiPhoneX_Top_Height ((kiPhoneXAll)?24:0)

//iPhoneX全系TabBar增加高度 (49->83)
#define kiPhoneX_Bottom_Height  ((kiPhoneXAll)?34:0)

//字符串去空格
#define allTrim(object) [object stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]

//弱引用
#define Weak(weakObj,strongObj)   __weak __typeof(&*strongObj) weakObj = strongObj;
#define kWeakSelf __weak typeof(self) weakSelf = self

//强引用
#define Strong(strongObj,weakObj) __strong __typeof(&*weakObj) strongObj = weakObj;

#endif /* BaseMacro_h */
